<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
<link rel="stylesheet" href="/Public/css/reset.css">
<link rel="stylesheet" href="/Public/css/index.css">
</head>
<body>
    

    <header>
        <h1><a href="<?php echo U('home/index/index');?>">My Blog</a></h1>
        <h4>所有的伟大，源于一个勇敢的开始.</h4>
    </header>
    
    <nav> 
        <ul>
            <?php if(is_array($top)): foreach($top as $key=>$value): ?><li><a href="<?php echo U('home/index/nav',array('cat_id'=>$value['cat_id'],'catname'=>$value['catname']));?>"><?php echo ($value['catname']); ?></a></li><?php endforeach; endif; ?>
        </ul>
    </nav>
    <div id="main">
        <div id="lside">


        <?php if(is_array($art)): foreach($art as $key=>$value): ?><article>
                <h2><a href="<?php echo U('home/index/art',array('art_id'=>$value['art_id']));?>"><?php echo ($value['title']); ?></a></h2>
                <div class="entry_header">
                    <time><?php echo ($value['pubtime']); ?></time>
                    by
                    <a href="#">Mr.z</a>
                    <span class="catlink" ><?php echo ($value['cat_id']); ?></span>
                    <span class="comment" ><?php echo ($value['comm']); ?></span>
                </div>
                <div class="entry_content">
                <?php echo ($value['content']); ?>
                </div>
            </article><?php endforeach; endif; ?>
        
            <div id="pagebar">
            <?php echo ($page); ?>
            </div>
        </div>
        <div id="rside">

            <aside>
                <form action="">
                    <input type="text" name="search" placeholder="Search..." id="one1">
                </form>
            </aside>

            <aside>
                <?php if(cookie_check() == 1): ?><h4>你登录啦~~</h4>
                <ul>
                    <li>你好,<?php echo (cookie('username')); ?></li>
                    <br/>
                    下面可以换头像
                </ul>
                <br/>
                <img src=<?php echo ($pic['pic']); ?> alt="">
                <br>

                <form action="<?php echo U('home/index/pic');?>" method="post" enctype="multipart/form-data">
                    
                    <input type="file" name="picture">
                    <br>
                    <br>
                    <input type="submit" value="提交">

                </form>

                <?php else: ?>

                <img src="/Public/flower.jpg" alt="" style="position:relative; left:60px;">
                <br>
                <br>
                <h3>&nbsp&nbsp加油，希望每天都像花儿一样美。</h3><?php endif; ?>
                
            </aside>
            
            <aside>
                
                    <h4>今日天气</h4>
                    <ul>
                    <li><?php echo ($weather['string'][1]); ?></li><br/>
                    
                    <li><?php echo ($weather['string'][6]); ?></li><br/>

                    <li><?php echo ($weather['string'][10]); ?></li><br/>
                    </ul>
                
            </aside>

            <aside>
                <h4>最新文章</h4>
                <ul>
                <?php if(is_array($hot)): foreach($hot as $key=>$value): ?><li><a href="<?php echo U('home/index/art',array('art_id'=>$value['art_id']));?>"><?php echo ($value['title']); ?></a>&nbsp;&nbsp;(<?php echo ($value['comm']); ?>)</li><?php endforeach; endif; ?>
                </ul>
            </aside>
            
            <?php if(cookie_check() == 1): ?><aside>
                <form action="">
                    <h4>只能评论哦~</h4>
                    <ul>
                    <li><a href="<?php echo U('home/user/register');?>">注册</a></li>
                    <br/>                    
                    <li><a href="<?php echo U('home/user/logout');?>">退出登录</a></li>
                    </ul>
                </form>
            </aside>            
            <?php else: ?>
            <aside>
                <form action="">
                    <h4>只能评论哦~</h4>
                    <ul>
                    <li><a href="<?php echo U('home/user/login');?>">登录</a></li>
                    <br/>
                    <li><a href="<?php echo U('home/user/register');?>">注册</a></li>
                    </ul>
                </form>
            </aside><?php endif; ?>
            
            <!-- <?php if($_COOKIE['username']== admin): ?>--> 

            <!-- 此处用于限制，不是admin的用户无法进入后台显示 -->
            
            <!-- <?php else: ?> -->

            <!--<?php endif; ?> -->
                <aside>
                
                    <h4>后台入口</h4>
                    <ul>
                    <li><a href="<?php echo U('admin/art/artlist');?>">进入</a></li><br/>
                    </ul>
                
                 </aside>


            
        </div>
    </div>
    <footer>
        Copyright &copy; 2015 · GeneratePress · WordPress
    </footer>
</body>
</html>